import request from '@/utils/request.js';
import {download, toFormData} from '@/utils/common.js';


/**
 * 分页查询学生推荐表信息
 */
export async function pageList(params) {
  const res = await request.get('/admin/student/recommend/list', {params});
  if (res.data.code === 200) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

/**
 * 查询学生推荐表信息
 * @returns {Promise<any>}
 */
export async function selectStudentRecommendInfo(code) {
  const res = await request.get('/admin/student/recommend/info/' + code);
  if (res.data.code === 200) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

/**
 * 批量查询学生推荐表信息
 * @param params
 * @returns {Promise<any>}
 */
export async function selectStudentRecommendInfos(params) {
  const res = await request.get('/admin/student/recommend/infos', {params});
  if (res.data.code === 200) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

/**
 * 获取核对单列表
 * @param params
 * @returns {Promise<any>}
 */
export async function selectCheckTableList(params) {
  const res = await request.get('/admin/student/recommend/checkTable', {params});
  if (res.data.code === 200) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}


/**
 * 导出学生填写推荐表进度表
 */
export async function exportRecommendFillState(params) {
  const res = await request({
    url: '/admin/student/recommend/export',
    method: 'POST',
    data: toFormData(params),
    responseType: 'blob'
  });
  download(res.data, `fillState_${Date.now()}.xlsx`);
}




